import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
		path: '/',
		component: () => import('../views/Index.vue'),
		children: [{
			path: '/',
			name: 'Home',
			component: () => import('../views/index/Index.vue')
		}, {
			path: '/company',
			name: 'Product',
			component: () => import('../views/company/Company.vue')
		}]
	}, {
		path: '/about',
		component: () => import('../views/Index.vue'),
		children: [{
			path: '/',
			name: 'about',
			component: () => import('../views/about/About.vue')
		}]
	},{
		path: '/device',
		component: () => import('../views/Index.vue'),
		children: [{
			path: '/',
			name: 'device',
			component: () => import('../views/device/Device.vue')
		}]
	},{
		path: '/serviceIdea',
		component: () => import('../views/Index.vue'),
		children: [{
			path: '/',
			name: 'serviceIdea',
			component: () => import('../views/serviceIdea/ServiceIdea.vue')
		}]
	},{
		path: '/partners',
		component: () => import('../views/Index.vue'),
		children: [{
			path: '/',
			name: 'partners',
			component: () => import('../views/partners/Partners.vue')
		}]
	},{
		path: '/customerService',
		component: () => import('../views/Index.vue'),
		children: [{
			path: '/',
			name: 'customerService',
			component: () => import('../views/customerService/CustomerService.vue')
		}]
	},

]

const router = new VueRouter({
	routes
})
router.beforeEach((to, from, next) => {
	window.scrollTo(0, 0); // 将页面滚动至顶部
	next()
})
export default router
